<?php
require_once ('../lib/config.php');
require_once ('../lib/facebook.php');
require_once ('../lib/friends.php');
require_once ('../lib/friend.php');
require_once ('../lib/test.php');
require_once ('f:\wamp\www\simpletest\autorun.php');
require_once ('../lib/init.php');

class TestTemplate extends UnitTestCase {
    
    function setUp(){
        global $login_button;
        $me = getOneself();
        if(!$me){
            print($login_button);
            exit();
        }
    }
    
    //refer to http://www.simpletest.org/en/unit_test_documentation.html
    function testCallMultiQuery(){ 
    
        $queries = array(
            "query1" => "select uid2 from friend where uid1 = me()",
            "query2" => "select name from user where uid IN (select uid2 from #query1)"
        );
        
        $response = callMultiFQL($queries);

        print_r($response);
        
        $this->assertNotNull($response);
        $this->assertTrue(is_array($response));
        
        $queries = null;
        $response = callMultiFQL($queries);
        $this->assertNull($response);
        
        $queries = "";
        $response = callMultiFQL($queries);
        $this->assertNull($response);
        
        $queries = array(
            "query1" => "select 1 from friend where uid1 = me()",
            "query2" => "select name from 1 where uid IN (select uid2 from #query1)"
        );
        try{
            $response = callMultiFQL($queries);
            $this->assertTrue(false);
        }catch(Exception $e){
            $this->assertTrue(true);
        }
        

    }
}
?>